<?$page_id="login";?>
<? include("includes/header.php") ?>
<?
	function isValidRole($vUserName,$vUserPassword){

		$role=0;
		if($vUserName=="itadministrator" && $vUserPassword=="3Murthee108")	 $role=SUPER_ADMIN;
		if($vUserName=="itadmin" && $vUserPassword=="Br8hma108")	 	$role=ADMIN;
		if($vUserName=="itsupervisor" && $vUserPassword=="shiva108")	 	$role=SUPERVISOR;
	
		$_SESSION["role_type"]=$role;
		if($role>0) return true;
		return false;
		
	}
	if($_POST) {
		
		if(isValidRole($_POST["txtadminUser"],$_POST["txtadminPwd"])) {
			writeLog("Admin User Logged in : ".$_POST["txtadminUser"],"",1 );
			$_SESSION["admin_key"] = "E45364";
			$_SESSION["admin_username"]=$_POST["txtadminUser"];
			header("location:registrants.php");
		}
		else {
			writeLog("Login failed for Admin user :".$_POST["txtadminUser"]);
			$message = "Invalid Username / Password. Please check again.";
		}
	}
?>






<form method="post" action="index.php">
	<div style="margin-left:265px;margin-top:60px;width:370px;text-align:center" class="section_panel"  >
	<? if($message!="") { ?><div class="errorBox" ><?=$message?></div><? }?>
	<table border="0"   cellpadding="6" width="100%" align="center">
		<tr>
		<td colspan="2" class="label_15 bold">Login Authentication</td>
		</tr>
		<tr>
			<td  class="label_14 bold">Username </td>
			<td><input type="text" size="40" name="txtadminUser" class="txtbox"  style="padding:3px;height:18px;"/></td>
		</tr>
		<tr>
			<td   ><span class="label_14 bold">Password </span></td><td> <input type="password" size="40" style="padding:3px;height:18px;" name="txtadminPwd" class="txtbox"/></td>
		</tr>
	
		<tr>	
			<td></td>
			<td align="left">

			<input type="submit" value="Sign in" class="button" style="margin-right:1px"/>
			<input type="button" value="Cancel" class="button" onclick="javascript:history.back()"/>
					
			</td>
		</tr>

	</table>
	</div>

</form>


<? include("includes/footer.php") ?>